# coding=utf-8
"""
Copyright (c) Huawei Technologies Co., Ltd. 2020-2028. All rights reserved.
Description:
FileName：run_test.py
Author: h00568282/huangbin 
Create Date: 2025/9/15 14:46
Notes:

"""

import argparse
from rich.console import Console
from typing import List

import argparse
from rich.console import Console
from typing import List
from mcp_server_manager import McpServerManager
from utils import print_server_config
console = Console()

def list_cmd(verbose: bool):
    global_config_manager = McpServerManager()
    servers = global_config_manager.list_servers()
    output_lines: List[str] = []
    if not servers:
        console.print("\n[yellow]No MCP servers found in global configuration.[/]")
        console.print("Use 'intelligence_ctl install <server>' to install a server.")
        console.print()
        return

    console.print(f"\n[bold]Found {len(servers)} server(s) in local env:[/]")
    console.print()

    # Display servers with their profiles
    for server_name, server_config in servers.items():
        console.print(f"[bold cyan]{server_name}[/]")

    console.print()

    if not verbose:
        console.print("[dim]Tip: Use 'intelligence_ctl ls -v' to see detailed server configurations[/]")
        console.print()

msg = {
"command": "list_cmd",
    "verbose": True
}
func_str = msg.pop("command")
func = eval(func_str)
func_res = func(msg)